Multi-protocol label switching (MPLS) supports multi-level labels and connection-oriented and is highly scalable, which provides various services for clients on a unified MPLS/IP-based network structure. A label distribution protocol (LDP) is a control protocol of the MPLS, and is equivalent to a signaling protocol in the prior network, which performs a series of operations including classification of forwarding equivalence class (FEC), label distribution, and establishment and maintenance of a label switched path (LSP). As the MPLS has increasingly become a basic technique for large-scale networks, the LDP, as an exclusive protocol for label distribution, has also attracted more and more attention.
Through the LDP, a label switched router (LSR) may directly map the route information of a network layer to a switched path of a data link layer so as to establish LSP on the network layer. The LSP may be established between two neighboring LSRs, and may also be terminated at an outlet node of the network, so that the label switch is adopted on all the intermediate nodes in the network. In the MPLS/IP network, if the LSP between two LSRs is not successfully established, packets are still forwarded in an IP forwarding manner, and till the LSP is successfully established, the packets can be forwarded in a label forwarding manner.
If the LDP initiating process of two LSRs is successfully accomplished, they become LDP peer entities, that is, LDP neighbors, which may exchange advertisement messages with each other. A label mapping message is one type of LDP advertisement messages, and includes a label, an FEC, and other information. Considering the data forwarding direction, when the relative positions between the two LSRs are described, the terms of upstream and downstream are adopted, and the packets are sent from an upstream LSR to a downstream LSR. In an MPLS system, the downstream LSR decides to distribute the label to a specific FEC and then notifies the upstream LSR, that is, the LSP label is distributed from the downstream to the upstream. When the LSP is established, the LSR distributes a label to the FEC, and sends a label mapping message to the upstream LSR, and after the upstream LSR receives all label mapping messages from the downstream LSR, the LSP between the two LSRs is established. The local LSR may decide when to send the label mapping message, and may also decide how to process the received label mapping message.
When the label retention manner of one LSR is a Liberal manner, if the LSR receives the label mapping message sent from the downstream, no matter whether the downstream is the next hop of the route of the LSR itself, the LSR keeps the label. In this case, the LDP generates one liberal LSP. If a liberal LSP is generated between two LSRs, once the route is changed into a forwarding path of the liberal LSP, the liberal LSP is quickly changed to a Normal LSP so as to forward the traffic with the label. The liberal LSP and the Normal LSP are two opposite concepts. When the liberal LSP is generated, the LSR does not forward the label according to this path, and when the liberal LSP is changed into the Normal LSP, the LSR forwards the label according to this LSP.
After an LDP session is established, if the route information is changed, the LSP is changed accordingly, and thus the LSP is required to be re-established. If a great number of route information (for example, 20,000 pieces) are changed on one LSR, certain convergence time is required from the end of handing over the route to the successful establishment of a great number of LSPs. Thus, in the convergence time, the packets can only be forwarded in the IP forwarding manner, so that the label forwarding manner is interrupted. During the handover process among label forwarding-IP forwarding-label forwarding, the flow loss problem may occur. If before establishing the LSP is accomplished, the packets are enabled to be forwarded in the label forwarding path before the route is changed, that is, the handing over the route is performed after the liberal LSP is entirely established successfully and then the liberal LSP is changed to the Normal LSP, the label forwarding interruption caused by the excessively long time spent on establishing the LDP session and the LSP can be avoided.
A typical application scenario of the above technique is handing over the route between two links, in which the reasons of handing over the route may be closing an interface, restarting a system, modifying a Cost value of the link, etc. In a ring topology formed by four connected LSRs as shown in FIG. 1, RTA to RTD are routers. Assuming that a link between RTB and RTC is interrupted (for example, the interface is closed), the RTA calculates that a route to the RTB should be a path of RTA-RTD-RTB, and the packets are routed along the label forwarding path of RTA-RTD-RTB. Assuming that the link between the RTB and the RTC is recovered, the RTA calculates that a route to the RTB should select a path of RTA-RTC-RTB, and in this case, after the route to be selected is changed (that is, indicating that the label forwarding direction to be adopted is RTA-RTC-RTB), the handing over the practical route is not performed, that is, the packets are still forwarded along the former label forwarding direction of RTA-RTD-RTB. However, meanwhile, the liberal LSP of RTA-RTC-RTB is established. After the liberal LSP is entirely established successfully, the route and the label forwarding path are handovered, so that the liberal LSP is changed to the Normal LSP, that is, the packets are forwarded along the label forwarding direction of RTA-RTC-RTB.
Currently, referring to FIG. 2, a flow of handing over the route by the upstream LSR includes the steps as follows.
In Step S101, the upstream LSR senses that a route to be selected is changed.
In Step S102, an LDP session between the upstream LSR and a downstream LSR is established.
In Step S103, the upstream LSR starts a set timer.
In Step S104, a liberal LSP between the upstream LSR and the downstream LSR is established.
In Step S105, the upstream LSR hands over the route after the timer is time-out.
The time of the timer may be configured by a user, or a certain empirical value is taken as a default time interval. Before the timer is time-out, the packets are still forwarded in the label forwarding path before the route is changed, the LDP may receive the label mapping message sent from the downstream for establishing the liberal LSP. As long as the timer is time-out, the route is handovered to enter the situation after the changing process, and the packet forwarding path is handovered accordingly.
The inventors find that, the setting of a timer aims at controlling the occasion for handing over the route and the LSP. However, when a great amount of liberal LSPs are established, the required time is closely associated with a processing speed, network state, and topology environment of the router and the like. During the practical applications, the timer may be time-out, but the liberal LSPs are not entirely established. Alternatively, the liberal LSPs have already been successfully established, but the timer is not time-out. If the former situation occurs, that is, during handing over the route, a part of the liberal LSPs is not successfully established yet, so that the label forwarding is interrupted. If the latter situation occurs, that is, the handing over the route is still not performed after the liberal LSPs have already been established, so that the convergence time of handing over the route is affected. Therefore, it cannot accurately determine that the liberal LSPs are re-established successfully by using a timer, and then handover the route.